﻿<%@ Page Title="Create Chatter" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CreateChatter.aspx.cs" Inherits="WebChat.Admin.CreateChatter" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:Label runat="server" ID="LiteralError" CssClass="errorMessage" />

    <table>
        <tr>
            <td>
                <asp:Label runat="server" AssociatedControlID="TextBoxUserName" Text="Username" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="TextBoxUserName" MaxLength="256" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxUserName" ValidationGroup="ValidationGroupChatter"
                        ErrorMessage="Username is required">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator runat="server" ControlToValidate="TextBoxUserName"
                        ValidationExpression="[a-zA-Z]([0-9a-zA-Z._]{4,})"  ValidationGroup="ValidationGroupChatter"
                        ErrorMessage="Username must be at least 5 characters, must start with a letter and can only contain letters, digits and . and _">
                        (5+), a-zA-Z0-9 ._
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" AssociatedControlID="TextBoxPassword" Text="Password" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="TextBoxPassword" MaxLength="128" TextMode="password" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxPassword" 
                        ValidationGroup="ValidationGroupChatter">*</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator runat="server" ControlToValidate="TextBoxPassword" 
                        ValidationGroup="ValidationGroupChatter"
                        ValidationExpression="^.*(?=.{6,})(?=.*\d)(?=.*[a-zA-Z])(?=.*[._@!#$%^&+=]).*$"
                        ErrorMessage="Password must be at least 6 characters, must contain a digit, must contain a character in the range a-z or A-Z, must contain at least one of these characters  $%_#@.+=&!^ " >
                        (5+), a-zA-Z0-9 ._ &#68; &#33; &#35; &#36; &#37; ^ &amp; +=
                </asp:RegularExpressionValidator>
                
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" AssociatedControlID="TextBoxPasswordRepeat" Text="Password" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="TextBoxPasswordRepeat" MaxLength="128" TextMode="password" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxPasswordRepeat" 
                        ValidationGroup="ValidationGroupChatter">*</asp:RequiredFieldValidator>
                <asp:CompareValidator runat="server" ControlToValidate="TextBoxPassword" ControlToCompare="TextBoxPasswordRepeat"
                        ValidationGroup="ValidationGroupChatter" ErrorMessage="Passwords don't match.">*</asp:CompareValidator>
                
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" AssociatedControlID="TextBoxFirstName" Text="First Name" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="TextBoxFirstName" MaxLength="50 " />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxFirstName" 
                        ValidationGroup="ValidationGroupChatter">*</asp:RequiredFieldValidator>                
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" AssociatedControlID="TextBoxLastName" Text="First Name" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="TextBoxLastName" MaxLength="50 " />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxLastName" 
                        ValidationGroup="ValidationGroupChatter">*</asp:RequiredFieldValidator>                
            </td>
        </tr>
        <tr>
            <td>
                Roles
            </td>
            <td>
                <p>
                    <asp:CheckBox runat="server" Checked="true" Enabled="false" Text="Chatter" />
                </p>
                <p>
                    <asp:CheckBox runat="server" ID="CheckBoxAdminsRole" Checked="true" Text="Admin" />
                </p>
            </td>
        </tr>
    </table>
    <asp:ValidationSummary runat="server" ID="ValidationSummary" ValidationGroup="a"  />

    <asp:Button runat="server" ID="ButtonCreateChatter" ValidationGroup="ValidationGroupChatter" Text="Create Chatter" 
            OnClick="ButtonCreateChatter_OnClick" />
</asp:Content>
